package com.itheima.controller;

import com.itheima.manager.AnalysisManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class AnalysisController {

    @Autowired
    AnalysisManager analysisManager;

    //获取首页统计数据
    @GetMapping("/dashboard/summary")
    public ResponseEntity findSummary() {
        return analysisManager.findSummary();
    }

    //数据统计
    @GetMapping("/dashboard/users")
    public ResponseEntity findSummaryData(
            @RequestParam(value = "sd")Long startDate,
            @RequestParam(value = "ed")Long endDate,
            String type
    ){
        return analysisManager.findSummaryData(startDate,endDate,type);
    }
}